TestBehaviorTree = BTBehaviorTree:New()

local this = TestBehaviorTree
this.name = "TestBehaviorTree"

function this:New()
	local o = {}
	setmetatable(o, self)
	self.__index = self
	o:Init()
	return o
end

function this:Init()
	local parallel = BTParallel:New()
	local action = self:GetBTActionUniversal()
    local action2 = self:GetBTActionUniversal2()

    self:SetStartTask(parallel)

    parallel:AddChild(action)
    parallel:AddChild(action2)
end

function this:GetBTActionUniversal()
    local count = 1
    local a = function ()
        if (count <= 3) then
            count = count + 1
            print("22")
            return BTTaskStatus.Running
        else
            return BTTaskStatus.Success
        end
    end
    local universal = BTActionUniversal:New(nil, a)
    return universal
end

function this:GetBTActionUniversal2()
    local universal = BTActionUniversal:New(nil, function ()
        return BTTaskStatus.Success
    end)
    return universal
end